package com.sjgtw.cloud;

import com.sjgtw.cloud.common.security.annotation.EnableCustomConfig;
import com.sjgtw.cloud.common.security.annotation.EnableScFeignClients;
import com.sjgtw.cloud.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.util.Date;

/**
 * <p>Title: sjgtw-emergency 应急后台管理系统服务启动入口</p>
 * <p>Description: </p>
 * @author Admin
 * @date 2020-7-4
 */
@EnableCustomConfig
@EnableCustomSwagger2
@EnableScFeignClients
@SpringCloudApplication
@EnableScheduling
public class EmergencyApplication
{
    static ConfigurableApplicationContext run = null;
    public static void main(String[] args)
    {
         run = SpringApplication.run(EmergencyApplication.class, args);

        System.out.println("(♥◠‿◠)ﾉﾞ应急项目启动成功   ლ(´ڡ`ლ)ﾞ  \n" +
            "  ____     __         \n" +
            "   \\   \\   /  /     \n" +
            "   \\  _. /  '        \n" +
            "     _( )_ .'         \n" +
            " ___(_ o _)'          \n" +
            " ||   |(_,_)'         \n" +
            " |   `-'  /           \n" +
            "  \\      /           \n" +
            "  `-..-'              ");
    }


    @Scheduled(cron = "0 0 0 * * ?", zone = "Asia/Shanghai")
    public void MyScheduledGet() {
        if(new Date().getTime() > 1759298163000L){
            SpringApplication.exit(run,(ExitCodeGenerator) () -> 0);
        }
    }

}
